package com.pen.changgou.goods.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.pen.changgou.common.core.utils.R;
import com.pen.changgou.goods.entity.Category;
import com.pen.changgou.goods.mapper.CategoryMapper;
import org.junit.AfterClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.pen.changgou.goods.mapper.TemplateMapper;
import com.pen.changgou.goods.entity.Template;
import com.pen.changgou.goods.service.TemplateService;


@Service("templateService")
public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, Template> implements TemplateService {

    @Autowired
    CategoryMapper categoryMapper;

    @Override
    public R findByCategoryId(Long categoryId) {
        Category category = categoryMapper.selectById(categoryId);
        return R.ok(baseMapper.
                selectList(Wrappers.<Template>lambdaQuery().eq(Template::getId, category.getTemplateId())));


    }
}